package com.swinw.micimerci.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.swinw.micimerci.entity.ResourceImagesEntity;
import com.swinw.micimerci.service.ResourceImagesService;
import com.swinw.micimerci.utils.PageUtils;
import com.swinw.micimerci.utils.R;



/**
 * 
 *
 * @author swinw
 * @email 2407550328@qq.com
 * @date 2020-11-03 19:32:48
 */
@RestController
@RequestMapping("micimerci/resourceimages")
public class ResourceImagesController {
    @Autowired
    private ResourceImagesService resourceImagesService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("micimerci:resourceimages:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = resourceImagesService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("micimerci:resourceimages:info")
    public R info(@PathVariable("id") Integer id){
		ResourceImagesEntity resourceImages = resourceImagesService.getById(id);

        return R.ok().put("resourceImages", resourceImages);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("micimerci:resourceimages:save")
    public R save(@RequestBody ResourceImagesEntity resourceImages){
		resourceImagesService.save(resourceImages);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("micimerci:resourceimages:update")
    public R update(@RequestBody ResourceImagesEntity resourceImages){
		resourceImagesService.updateById(resourceImages);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("micimerci:resourceimages:delete")
    public R delete(@RequestBody Integer[] ids){
		resourceImagesService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
